﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace inf_1007_devoir3
{
    class CtrlClient
    {
        private static CtrlClient instance;
        private List<Client> clients;
        
        private CtrlClient()
        {
            clients = new List<Client>();

            initialiser();
        }

        public static CtrlClient getInstance()
        {
            if (instance == null)
            {
                instance = new CtrlClient();
            }

            return instance;
        }

        private void initialiser()
        { 
            clients.Add(new Client("Hamelin", "Frédéric","123 rue Unetelle","Trois-Rivières","Québec","Canada","1234-123456-12",new DateTime(1991,7,13),"1234567890","aaa@bbb.com"));
            clients.Add(new Client("Duhaime", "Marc-André", "123 rue UnTel", "Trois-Rivières", "Québec", "Canada", "0987-098765-09", new DateTime(1991, 2, 23), "0987654321", "bbb@aaa.com"));
        }

        public List<Client> getClients()
        {
            return clients;
        }

        public Client getClient(string noPermis)
        {
            foreach (Client cl in clients)
            {
                if (noPermis == cl.getNoPermisConduire())
                {
                    return cl;
                }
            }

            return null;
        }
    }
}
